package com.example.coursehub.repository;

import com.example.coursehub.entity.StudentChapter;
import com.example.coursehub.entity.StudentChapterId;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface StudentChapterRepository extends JpaRepository<StudentChapter, StudentChapterId>, JpaSpecificationExecutor<StudentChapter> {


    List<StudentChapter> findByUser_UserId(String studentId);


    int countByUser_UserIdAndChapter_Course_CourseIdAndIsFinishedTrue(String user_userId, String chapter_course_courseId);

    List<StudentChapter> findByUser_UserIdAndChapter_Course_CourseIdAndIsFinished(String userId, String courseId, boolean b);
}